<template>
	<view class="result">
		<view class="tips" v-if="msg != 'ok'">
			{{msg}}
		</view>
		<view class="item" v-for="(item, index) in list" :key="index" :class="item.et_count ? 'warning':'success'"
			@click="change(item)">
			<view class="box">
				<view class="label">
					身份证号：
				</view>
				<view class="value">
					{{item.idcard}}
				</view>
			</view>
			<view class="box">
				<view class="label">
					所在地区：
				</view>
				<view class="value">
					{{item.regions}}
				</view>
			</view>
			<view class="box">
				<view class="label">
					客人年龄：
				</view>
				<view class="value">
					{{item.age}}岁
				</view>
			</view>
			<view class="box">
				<view class="label">
					客人性别：
				</view>
				<view class="value">
					{{item.sex}}
				</view>
			</view>
			<view class="box" v-if="item.et_count">
				<view class="label">
					参团次数：
				</view>
				<view class="value">
					{{item.et_count}}次
				</view>
			</view>
			<view class="more" v-if="item.et_count" @click.stop="more(item.et_count, item.children)">
				查看详情<uni-icons type="right" size="15" color="#f30"></uni-icons>
			</view>

			<view class="status">
				<uni-icons type="info-filled" size="35" color="#f30" v-if="item.et_count"></uni-icons>
				<uni-icons type="checkbox-filled" size="35" color="#3d7eff" v-else></uni-icons>
			</view>
		</view>
	</view>
</template>

<script setup>
	defineProps({
		list: Array,
		msg: String,
	})

	import cache from "@/util/cache.js"

	import user from "@/common/user";

	const change = item => {
		let info = user.getUser()
		if (info && info.grade == 3) {
			uni.$rui.route('/pages/user/idcard/idcard', {
				idcard: item.idcard,
				regions: item.regions,
				sex: item.sex
			})
		}
	}

	const more = (count, children) => {
		if (count == 0) return false;
		uni.navigateTo({
			url: "/pages/user/warning/warning",
			success() {
				cache.put('Result_Warning', children, 60*30)
			}
		})
		
	}
</script>

<style lang="scss" scoped>
	.result {
		.more {
			text-align: center;
			padding: 20rpx;
		}

		.tips {
			background: #f5f5f5;
			color: #888;
			font-size: 24rpx;
			padding: 6rpx 10rpx;
			border-radius: 50rpx;
		}

		.warning {
			color: #f30;
		}

		.success {
			color: #333;
		}

		.item {
			margin: 30rpx 0;
			position: relative;

			.value-view {
				color: #999;
				font-size: 24rpx;
			}

			.status {
				position: absolute;
				right: 0;
				top: 50%;
				transform: translate(0%, -50%);
			}

			.box {
				display: flex;
				line-height: 44rpx;

				.label {
					color: #999;
					margin-right: 5rpx;
					font-size: 24rpx;
				}
			}

		}

	}
</style>